package mySwing;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

import javax.swing.JFileChooser;
import javax.swing.JTextField;

/**
 *  www.dimtirisk.gr
 * @author dimitris
 */
public class brownseB extends JButton implements ActionListener {

    private JTextField tf;
    public brownseB(){
        this.setText("...");
        this.addActionListener(this);
    }

    public void actionPerformed(ActionEvent e) {

        JFileChooser fc = new JFileChooser("./");
        fc.setFileSelectionMode(fc.DIRECTORIES_ONLY);
        fc.showOpenDialog(fc);
        
        tf.setText(fc.getSelectedFile().getName());
    
    }

    public JTextField getTf() {
        return tf;
    }

    public void setTf(JTextField tf) {
        this.tf = tf;
    }
}
